package OOM;

import java.util.ArrayList;
import java.util.List;

/**
 * -Xms600m -Xmx600m -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/logs/heapdump.hprof
 */
public class OOMHeapDump {
    public static void main(String[] args) {
        List<byte[]> list = new ArrayList<>();
        int count = 0;
        for (int i = 0; i < 10240; i++) {
            System.out.println("count次数=" + count++);
            list.add(new byte[1024 * 1024]);
            try {
                Thread.sleep(2*1000);
            } catch (InterruptedException e) {

            }

        }
    }
}
